import request from '@/utils/request'
import {FileType} from '@/utils/enum'
//分类列表
export const FileCategorys = (type: FileType): Promise<ServiceResponse<FileCategory[]>>  => request({ url: 'file/oss/category/list',data: { type }, method: 'GET' })
//编辑分类
export const FileCategorySave = (data: FileCategory): Promise<ServiceResponse<any>> => request({ url: 'file/oss/category/save', data, method: 'POST' })
//删除分类
export const FileCategoryRemove = (id:number) :any => request({ url: `file/oss/category/${id}`, method: 'DELETE' })
//列表
export const Files = (data: PageModel<FileQuery>): Promise<ServiceResponse<FileView[]>> => request({ url: 'file/oss/list', data, method: 'POST' })
//修改名称
export const SetFileName = (id:number,name: string): Promise<ServiceResponse<any>> => request({ url: 'file/oss/setname', data: {id, name}, method: 'GET' })
//编辑分组
export const SetFileGroup = (data: BatchEdior): Promise<ServiceResponse<any>> => request({ url: 'file/oss/setgroup', data, method: 'POST' })
//删除文件
export const FileRemove = (data: BatchEdior): Promise<ServiceResponse<any>> => request({ url: 'file/oss/remove', data, method: 'POST' })
// 上传视频
export const UploadVideo = (data:FormData) : Promise<ServiceResponse<FileEditor>> => request({ url: 'file/oss/video/upload',data, method: 'POST', contentType: 'file' })
// 上传图片
export const UploadImage = (data:FormData) :Promise<ServiceResponse<FileEditor>> => request({ url: 'file/oss/image/upload',data, method: 'POST', contentType: 'file' })
